
# cmake_minimum_required(VERSION 2.8)
# project(test)
# set(CMAKE_BUILD_TYPE "release")
# set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
# # 指定libTorch位置
# set(Torch_DIR /home/lenovo/libtorch/share/cmake/Torch)
# find_package(Torch REQUIRED)

# find_package(OpenCV REQUIRED)

# include_directories(${OpenCV_INCLUDE_DIRS}
#                     /home/lenovo/libtorch/include
#                     /home/lenovo/libtorch/include/torch/csrc/api/include
#                     )

# add_executable(Test test.cpp)
     
# # Link your application with OpenCV libraries
# target_link_libraries(Test ${OpenCV_LIBS} ${TORCH_LIBRARIES} )


cmake_minimum_required(VERSION 3.0 FATAL_ERROR)

project(test)

set(Torch_DIR /home/lenovo/libtorch/share/cmake/Torch)

find_package(Torch REQUIRED)

find_package(OpenCV REQUIRED)

if(NOT OpenCV_FOUND)

find_package(OpenCV 2.4.3 QUIET)

if(NOT OpenCV_FOUND)

message(FATAL_ERROR "OpenCV > 2.4.3 not found.")

endif()

endif()

add_executable(${PROJECT_NAME} test.cpp)

target_link_libraries(${PROJECT_NAME} ${TORCH_LIBRARIES} ${OpenCV_LIBS})

set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) 